package demoMod.stsconsole.powers;

import demoMod.stsconsole.cards.AbstractCard;
import demoMod.stsconsole.characters.AbstractPlayer;
import demoMod.stsconsole.dungeons.AbstractDungeon;
import demoMod.stsconsole.interfaces.AddTempCardsSubscriber;
import demoMod.stsconsole.interfaces.PostDrawSubscriber;

public class CorruptionPower extends AbstractPower implements AddTempCardsSubscriber, PostDrawSubscriber {
    public static final String ID = "CorruptionPower";

    public CorruptionPower() {
        super(ID, AbstractDungeon.player, new int[0]);
    }

    @Override
    public void onInitialApplication() {
        AbstractPlayer p = AbstractDungeon.player;
        for (AbstractCard card : p.drawPile) {
            if (card.type == AbstractCard.CardType.SKILL) {
                card.cost = 0;
                card.exhaust = true;
            }
        }
        for (AbstractCard card : p.hand) {
            if (card.type == AbstractCard.CardType.SKILL) {
                card.cost = 0;
                card.exhaust = true;
            }
        }
        for (AbstractCard card : p.discardPile) {
            if (card.type == AbstractCard.CardType.SKILL) {
                card.cost = 0;
                card.exhaust = true;
            }
        }
        for (AbstractCard card : p.exhaustPile) {
            if (card.type == AbstractCard.CardType.SKILL) {
                card.cost = 0;
                card.exhaust = true;
            }
        }
    }

    @Override
    public String getUpdatedDescriptions() {
        return this.description;
    }

    @Override
    public void preAddTempCards(AbstractCard card) {
        if (card.type == AbstractCard.CardType.SKILL) {
            card.cost = 0;
            card.exhaust = true;
        }
    }

    @Override
    public void onCardDraw(AbstractCard card) {
        if (card.type == AbstractCard.CardType.SKILL) {
            card.cost = 0;
            card.exhaust = true;
        }
    }

    @Override
    public int getPriority() {
        return super.getPriority() + 5;
    }
}
